import { ToastOption } from '@/types/index'
export default {
    state:{
        msg: 'toast',
        type: 'text',
        show: false,
        duration: 2000
    },
    getters:{
        toast:(state)=>state
    },
    mutations:{
        setToast (state, option:ToastOption) {
            state.msg = option.msg
            state.type = option.type
            state.show = option.show
            state.duration = option.duration
        }
    },
    actions:{
        setToast(context, options:ToastOption){
            context.commit('setToast',options)
        }
    }
}
